#pragma once

#include <physics/Registrator.h>

struct b2BodyDef;
class b2Shape;

namespace liba { namespace lib3d { namespace node { class Node; }}}

namespace physics
{

class Node;

class NodeLoader: public xml::ObjectANSI
{
	std::auto_ptr <b2BodyDef> bodyDef;

	float massAttribute;

protected:
	Node *node;

	virtual bool on_node(xml::Provider *prov, const std::string &name);
	virtual bool on_attribute(xml::Provider *prov, const std::string &name, const std::string &value);
	virtual bool on_end_node(xml::Provider *prov);

	virtual std::auto_ptr <b2FixtureDef> CreateFixtureDef();
	virtual std::auto_ptr <b2Shape> CreateShape();

public:
	NodeLoader(Node *node);
	virtual ~NodeLoader();
};

}	// namespace physics